﻿@model MyNeighbourhood.Models.FeedbackModel

@{
    ViewBag.Title = "Feedback";
}

<h2>Tell us what you think</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div>
        @Html.DropDownListFor(x => x.Type, new SelectList(ViewBag.AllTypes), "Choose type", new { title = "Choose type", id = "feedback-type" })
        @Html.ValidationMessageFor(x => x.Type)
    </div>
    
    <div>
        @Html.TextBoxFor(x => x.Subject, new { title = "Subject", placeholder = "Subject" })
        @Html.ValidationMessageFor(x => x.Subject)
    </div>
    
    <div>
        @Html.TextAreaFor(x => x.Text, new { title = "Share your thoughts", placeholder = "Share your thoughts", id = "feedback-text" })
        @Html.ValidationMessageFor(x => x.Text)
    </div>
    
    <div>
        @Html.TextBoxFor(x => x.Name, new { title = "Your name", placeholder = "Your name" })
        @Html.ValidationMessageFor(x => x.Name)
    </div>
    
    <div>
        @Html.TextBoxFor(x => x.Email, new { title = "Your email", placeholder = "Your email" })
        @Html.ValidationMessageFor(x => x.Email)
    </div>
    
    <h5>Choose who to receive your opinion</h5>
    
    
    for (int i = 0; i < Model.Receivers.Count; i++)
    {
        string text = Model.Receivers[i].Contact.Title;
    <div>
        @Html.HiddenFor(x=>x.Receivers[i].Contact.Email)
        @Html.CheckBoxFor(x => x.Receivers[i].ShouldReceive)
        @Html.LabelFor(x => x.Receivers[i].ShouldReceive, text)
    </div>
    }
    
    <p>
        <input type="submit" value="Send" />
    </p>

}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
